package estyle.auto.nkornilova;

import estyle.auto.nkornilova.model.Message;
import estyle.auto.nkornilova.pages.TestBase;
import org.testng.annotations.Test;

import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;

/**
 * Created with IntelliJ IDEA.
 * User: nkornilova
 * Date: 06.05.13
 * Time: 12:35
 * To change this template use File | Settings | File Templates.
 */
public class PaperAccountMessage extends TestBase {

    //Создать первичное об открытии сообщение
    @Test
    public void CreatePrimaryOpenMessage() throws Exception {
        //Логин под админом
        appManager.getNavigateHelper().openRelativeUrl("login.do");
        appManager.getUserHelper().loginAs(ADMIN);
        assertTrue(appManager.getUserHelper().isLoginAs());

        //Переход на грид сообщений
        appManager.getBankAccountMessageGridHelper().selectMenu();
        assertTrue(appManager.getBankAccountMessageGridHelper().isVisibleGrid());

        //Создание сообщения об открытии
        appManager.getBankAccountMessageGridHelper().createCreateMessage();
        assertTrue(appManager.getBankAccountMessageHelper().isVisible());

        //Заполнение формы ввода
        Message message = appManager
                .getBankAccountMessageHelper()
                .getMessageFromXML("\\src\\test\\java\\estyle\\auto\\nkornilova\\SuccessTestDataXML\\PrimaryMessageAboutCreating.xml");
        appManager
                .getBankAccountMessageHelper()
                .createSuccessPaperBankAccountPrimaryMessageAboutCreating(message);


        //check alert exists
         assertFalse(appManager.getBankAccountMessageHelper().isAlertExists(), "Exists message, text = " + appManager.getBankAccountMessageHelper().getAlertText());
        //check message form
        //assertTrue(appManager.getBankAccountMessageHelper().checkInsurerFieldAfterChosen(message), "Insurer attributes are failed");
    }
}
